package net.test.filter;

import javax.servlet.http.HttpServletRequest;

import org.springframework.security.Authentication;
import org.springframework.security.AuthenticationException;
import org.springframework.security.ui.webapp.AuthenticationProcessingFilter;

public class _AuthenticationProcessingFilter extends AuthenticationProcessingFilter{

	@Override
	public Authentication attemptAuthentication(HttpServletRequest request)
			throws AuthenticationException {
		
		Authentication authentication =null;
		authentication = super.attemptAuthentication(request);
		
		String status = null;  
		String uri = request.getRequestURI();
		if (uri.indexOf("/admin/") != -1) {  
			status = "admin";
		}
		request.getSession().setAttribute("status", status);
		return authentication;
	}
}
